import request from '../utils/request';
import { API } from '../utils/config';

/**
 * 获取属性列表
 */
export const getAttributeList = () => {
  return request({
    url: `${API.CLASSES}/ProductSku`,
    method: 'GET',
    params: {
      order: 'sort'
    }
  });
};

/**
 * 创建属性
 * @param data 属性数据
 */
export const createAttribute = (data: any) => {
  return request({
    url: `${API.CLASSES}/ProductSku`,
    method: 'POST',
    data
  });
};

/**
 * 更新属性
 * @param id 属性ID
 * @param data 属性数据
 */
export const updateAttribute = (id: string, data: any) => {
  return request({
    url: `${API.CLASSES}/ProductSku/${id}`,
    method: 'PUT',
    data
  });
};

/**
 * 删除属性
 * @param id 属性ID
 */
export const deleteAttribute = (id: string) => {
  return request({
    url: `${API.CLASSES}/ProductSku/${id}`,
    method: 'DELETE'
  });
};

/**
 * 获取属性详情
 * @param id 属性ID
 */
export const getAttributeDetail = (id: string) => {
  return request({
    url: `${API.CLASSES}/ProductSku/${id}`,
    method: 'GET'
  });
};